import com.lucnn.diamond.spring.config.LifeCycleConfig;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

public class IocTestLifeCycle {

    AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(LifeCycleConfig.class);

    private void printBeans(ApplicationContext ctx){
        String[] names = ctx.getBeanDefinitionNames();
        for(String name:names){
            System.out.println(name);
        }
    }

    @Test
    public void testLifeCycle(){
        printBeans(ctx);
        ctx.close();
    }


}
